#include <stdio.h>
#include <stdlib.h> 
#include <math.h>
#include <string.h>

int main(int argc, char const *argv[])
{
#if 0
    char a[100]={0};
    
    printf("请输入一个字符串>:");
    scanf("%s",a);
    printf("字符串为:%s\n",a);

    int len = strlen(a);
    double num;
    float x,y;
    //int x = atoi(a);
    //printf("转换整数为:%d\n",x);
    for (int i = 0; i < len; i++)
    {
        x = a[i]-'0';

        num += x*pow(10,len-1-i);
    }
    printf("转换后为:%d\n",(int)num);
#endif  

#if 1
    int a;
    printf("请输入整数>:");
    scanf("%d",&a);
    printf("整数为:%d\n",a);

    int len = 0;
    int t = a;
    char str[100]={0};

    for ( len = 1; t/10 != 0; t /=10)
    {
        len++;
    }
    printf("len=%d\n",len);
    t = a;
    for (int i = 0,x=0; i < len; i++)
    {
        x = t%10;
        printf("x=%d\n",x);
        t = t/10;
        str[len-1-i] = x + '0';
    }
    printf("str=%s\n",str);
    
#endif
    return 0;
}
